<%@ page pageEncoding="UTF-8"%>
<%@ include file="/common/validate.jsp"%>
<%
    // 微信获取个人信息
    String token = input.getDesc("token", "");
	List<Map> tokenList = QBuilder.db("basedb").queryHql("from token where hospital = "+ hospital + " and token = '" + token + "'");
	if (tokenList.size() == 0) {
		msg = new Message(30041, "没有用户信息");
        msg.put("data", new HashMap());
		Tools.encryptPrint(out, msg);
		return;
	} else {
		Map tokenMap = tokenList.get(0);
        String content = "new map(up.phone as phone, up.patientId as patient_id, up.cardType as card_type,up.cardNumber as card_number,up.medicalType as medical_type, up.id as pid, up.medicalNumber as medical_number,u.mail as mail, u.question as question, u.answer as answer,u.address as address,u.userName as user_name,u.nickName as nick_name , u.name as name, u.id as uid, u.avatar as avatar,u.gender as gender)";
		List<Map> list = QBuilder.db("basedb").select(content).from("User as u,UserProfile as up").where(new Where("u.id=", tokenMap.get("uid")).and("u.hospital=", hospital).and("u.type=", USER_PATIENT).and("u.id=up.uid").and("up.self=", SELF).and("up.status=", STATUS_ENABLE).and("u.status=", STATUS_ENABLE)).query().getResultObj();
		if (list.size() == 0) {
			msg = new Message(30041, "没有用户信息");
            msg.put("data", new HashMap());
			Tools.encryptPrint(out, msg);
			return;
		}
		msg.put("data", list.get(0));
		Tools.encryptPrint(out, msg);
	}
%>
